home *** CD-ROM | disk | FTP | other *** search
/ Delphi Programmer's Power Pack / Delphi Volume 1.iso / s_to_z / vpe_130 / minidemo.cpp < prev    next >
C/C++ Source or Header  |  1996-09-15  |  4KB  |  119 lines

  1.  
  2.  
  3.  
  4. #include "windows.h"
  5. #include "vpiface.h"
  6. #include "vpecomon.h"
  7. #include <colors.h>
  8.  
  9.  
  10.  
  11. char *DemoText =
  12. "[PS 3 S 12 C Black J BO]The moment of impact bursts through the silence and in a roar of sound, the "
  13. "final second is prolonged in a world of echoes as if concrete and clay of "
  14. "Broadway itself was reliving its memories.\n"
  15. "The last great march past. Newsman stands limp as a whimper as audience and "
  16. "eventare locked as one. Bing Crosby coos'You don't have to feel pain "
  17. "to sing the blues, you don't have to holla - you don't feel a thing in your "
  18. "dollar collar.' Martin Luther cries 'Everybody Sing!' and rings the grand old "
  19. "liberty bell. Leary, weary of his prison cell, walks on heaven, talks on hell.\n"
  20. "Who needs Medicare and the 35c flat rate fare, when Fred Astaire and "
  21. "Ginger Rogers are dancing through the air? From Broadway Melody stereotypes "
  22. "the band returns to 'Stars and Stripes' bringing a tear to the moonshiner, "
  23. "who's been pouring out his spirit from the illegal still. The pawn broker "
  24. "clears the noisy till and clutches his lucky dollar bill.\n"
  25. "Then the blackout.\n\n"
  26. "(Genesis, 'The Lamb lies down on Broadway')";
  27.  
  28.  
  29. // ========================================================================
  30. //                              MiniDemo
  31. // ========================================================================
  32. void MiniDemo(HWND hwnd)
  33. {
  34.    long hdoc;
  35.  
  36.    hdoc = VpeOpenDoc(hwnd, "Mini Demo", -1, -1, 0);
  37.    VpeWriteBox(hdoc, 100, 100, 500, 200,
  38.                "[PS 0 B C LtRed]Hello");
  39.    VpeWriteBox(hdoc, 100, 250, 500, 350,
  40.                "['Times New Roman' S 30 C Blue]World!");
  41.    VpeWriteBox(hdoc, 100, 450, 1900, -1, DemoText);
  42.  
  43.    VpePreviewDoc(hdoc, NULL, VPE_SHOW_NORMAL);
  44. }
  45.  
  46.  
  47.  
  48.  
  49. // ========================================================================
  50. //                              WndProc
  51. // ========================================================================
  52. long FAR PASCAL _export WndProc(HWND hwnd, UINT message, UINT wParam, LONG lParam)
  53. {
  54.    switch (message)
  55.    {
  56.     case WM_CREATE :
  57.        MiniDemo(hwnd);
  58.        return 0 ;
  59.  
  60.     case VPE_DESTROYWINDOW:
  61.     case WM_DESTROY:
  62.        PostQuitMessage(0);
  63.        return 0;
  64.    }
  65.  
  66.    return DefWindowProc (hwnd, message, wParam, lParam) ;
  67. }
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75. // ========================================================================
  76. //                              WinMain
  77. //
  78. // Create a hidden Main Window
  79. // ========================================================================
  80. int PASCAL WinMain (HANDLE hInstance, HANDLE hPrevInstance,
  81.                                                   LPSTR lpszCmdLine, int )
  82. {
  83.    static char szAppName [] = "Mini Demo";
  84.    MSG         msg ;
  85.    HWND        hwnd ;
  86.    WNDCLASS    wndclass ;
  87.  
  88.  
  89.    if (!hPrevInstance)
  90.    {
  91.       wndclass.style         = CS_HREDRAW | CS_VREDRAW ;
  92.       wndclass.lpfnWndProc   = WndProc ;
  93.       wndclass.cbClsExtra    = 0 ;
  94.       wndclass.cbWndExtra    = 0 ;
  95.       wndclass.hInstance     = hInstance ;
  96.       wndclass.hIcon         = LoadIcon (hInstance, "APP_ICON");
  97.       wndclass.hCursor       = LoadCursor (NULL, IDC_ARROW) ;
  98.       wndclass.hbrBackground = GetStockObject (WHITE_BRUSH) ;
  99.       wndclass.lpszMenuName  = szAppName ;
  100.       wndclass.lpszClassName = szAppName ;
  101.       RegisterClass (&wndclass) ;
  102.    }
  103.  
  104.    hwnd = CreateWindow (szAppName, szAppName,
  105.                         WS_OVERLAPPEDWINDOW,
  106.                         CW_USEDEFAULT, CW_USEDEFAULT,
  107.                         CW_USEDEFAULT, CW_USEDEFAULT,
  108.                         NULL, NULL, hInstance, NULL) ;
  109.  
  110.    while (GetMessage (&msg, NULL, 0, 0))
  111.    {
  112.       TranslateMessage (&msg) ;
  113.       DispatchMessage (&msg) ;
  114.    }
  115.  
  116.    return msg.wParam ;
  117. }
  118.  
  119.